<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="menu.jsp" />
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="css/my.css" />
<script type="text/javascript" src="js/jquery-3.2.0.min.js"></script>
</head>
<body>
    <c:if test="${empty username}">
        <script type="text/javascript">
            alert('请先登录！');
            window.location.href = 'login.jsp';
        </script>
    </c:if>
    <c:if test="${not empty username}">
        <h1 class="title">个人信息</h1>
        <form action="updateuserinfo" method="post">
            <table>
                <tr>
                    <td>账号</td>
                    <td><input type="text" name="username" disabled="disabled" value="${userinfo.username}"/>
                    </td>
                </tr>
                <tr>
                    <td>Email</td>
                    <td><input type="text" name="email" value="${userinfo.email}"/></td>
                </tr>
                <tr>
                    <td>性别</td>
                    <td style="text-align: left;">
                        <input type="radio" name="sex" value="1" ${userinfo.gender==1?'checked':''}/>男 
                        <input type="radio" name="sex" value="0" ${userinfo.gender==0?'checked':''}/>女
                    </td>
                </tr>
                <tr>
                    <td>关注类型</td>
                    <td>
                        <input type="checkbox" name="type" value="法律法规" />法律法规
                        <input type="checkbox" name="type" value="管理办法" />管理办法 
                        <input type="checkbox" name="type" value="决定条例" />决定条例 
                        <input type="checkbox" name="type" value="细则解释" />细则解释 
                        <input type="checkbox" name="type" value="规范指南" />规范指南
                    </td>
                </tr>
            <c:forEach items="${types}" var="type">
                <script>
                    $("input[value='${type}']").attr("checked","checked");
                </script>
            </c:forEach>
                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="返回" onclick="window.location.href='index.jsp'"/>
                        <input type="submit" value="修改" />
                    </td>
                </tr>
            </table>
        </form>
    </c:if>
</body>
</html>